﻿using Application.Interfaces.Encryption;
using Domain.Models.Account;
using Domain.Models.Settings;
using System.Collections.Generic;
using System.Security.Permissions;

namespace Application.Services
{
    public class BlogSeedService : ISeedService
    {
        private IEncryptionService _encryptionService;

        public BlogSeedService(IEncryptionService encryptionService)
        {
            this._encryptionService = encryptionService;
        }

        [PrincipalPermission(SecurityAction.Assert)]
        public List<object> GetSeeds()
        {
            var entities = new List<object> {
                new Setting{ Name="王刚的博客",
                    LogoImageUrl="logo.png",
                    MetaTitle="王刚的博客",
                    Copyright = "Copyright © 2006-2015  nbaxp.com All Rights Reserved.",
                    Css="",
                    Js="",
                    Template="blog",
                    Style="default"
                },
                new Customer{
                    UserName="user",SaltKey="1",Password=_encryptionService.CreatePasswordHash("111111","1"),Email="76527413@qq.com"
                },
                new Customer{
                    UserName="admin",SaltKey="1",Password=_encryptionService.CreatePasswordHash("111111","1"),Email="csurn@163.com"
                    ,Roles = new List<Role>{new Role{ Name="管理员", Permisions=Permission.Admin}}
                }
            };
            return entities;
        }
    }
}